from confignb import ConfigNB
from actionsnb import ActionsNB
from blockpcd import BlockPCD
import time

def main():
	config = ConfigNB()
	pcblockd = BlockPCD()
	actions = ActionsNB()
	while True:
		try:
			if config.isDevicePerdido():
				actions.tomarScreenshot()
			if config.isPcBloqueadoConfig():
				if not pcblockd.isAlive():
					pcblockd = BlockPCD()
					pcblockd.blockPc()
			elif pcblockd.isAlive():
				pcblockd.desblockPc()
			if config.isAlertActive() and not config.isPcBloqueadoConfig():
				actions.mostrarMensaje(config.getMsgAlert())
		except:
			print "Problemas la tomar foto de webcam"
		time.sleep(60.0)    
    
if __name__=="__main__":
    main()